home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Software Vault: The Gold Collection
/
Software Vault - The Gold Collection (American Databankers) (1993).ISO
/
cdr25
/
windlg.zip
/
WINDLG.TXT
< prev
Wrap
Text File
|
1993-04-17
|
2KB
|
40 lines
This is a simple example of how to do a PM app with a
dialog box as its main window.
There's not much to explain, except maybe the MSGMAP_BEGIN
stuff at the top of the file. MSGMAP_* and CMDMAP_* are
macros #defined in msgmap.h, which i usually use to eliminate
the huge, clumsy switch statements in the window proc. Since
the use of this method makes the window proc a real simple
function, i decided to put it in a macro, and eliminate it from
the code, or at least give the appearance of it not being there.
the parameter you pass to MSGMAP_BEGIN is the name of the
MSGMAP variable that will be used.(for more info, see msgmap.h)
the parameters you pass to MSGMAP_END are the name of the MSGMAP
variable mentioned above, the address of the window proc for this
MSGMAP, and the name of the subclassed window proc. This allows you
to have more than one MSGMAP, so you can subclass windows, etc.
the CMDMAP_BEGIN macro takes the name of another MSGMAP variable.
the CMDMAP_END macro takes the name of the MSGMAP variable, and
the address of the command proc, or (usually) the function that
handles WM_COMMAND messages. this could probably be used to handle
WM_SYSCOMMAND messages too, but i haven't messed with it, so i don't
know.
note that when using this method, you MUST prototype every
function mentioned in the MSGMAP_* and CMDMAP_* sections(with
the exception of the ones prototyped in msgmap.h), or the
compiler will crap out with lots of error messages.
Thanks to Bill Leonard, and Joerg Reimers, for showing
me how to get the dialog box part to work.
you're free to use this code as you like.
Enjoy it,
Kelly Schrock
CIS id: 70572,1247